import 'package:flutter/material.dart';
import 'package:xindong/common/xindong_sezhi.dart';
import 'package:xindong/manager/xindong_page_singleton.dart';
import 'package:xindong/res/assets_res.dart';
import 'package:xindong/widgets/dialog/xindong_base_alert.dart';

class XinDongDongTaiPublishFailedDialog extends StatelessWidget {
  final dynamic money;
  final Function() onTapPay;

  const XinDongDongTaiPublishFailedDialog({super.key, this.money, required this.onTapPay});

  XinDongDongTaiPublishFailedDialog.show({super.key, required this.money, required this.onTapPay}) {
    showAlertDialog(alert: this);
  }

  @override
  Widget build(BuildContext context) {
    return XinDongBaseDialog(
      body: Center(
        child: Container(
          width: 280,
          height: 280 * 1084 / 874 + 30,
          padding: const EdgeInsets.only(left: 30, right: 30, bottom: 16),
          decoration: BoxDecoration(
            color: Colors.white,
            borderRadius: BorderRadius.circular(16),
            image: const DecorationImage(
              image: AssetImage(AssetsRes.IMAGE_MOMENT_FAILED),
              fit: BoxFit.fitWidth,
              alignment: Alignment.topCenter,
            ),
          ),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.end,
            children: [
              GestureDetector(
                onTap: () => XinDongPageSingleton.instance.openNoble(),
                child: Container(
                  height: 40,
                  margin: const EdgeInsets.only(bottom: 10),
                  alignment: Alignment.center,
                  decoration: BoxDecoration(
                    borderRadius: BorderRadius.circular(30),
                    // 渐变色
                    gradient: LinearGradient(
                      begin: Alignment.topCenter,
                      end: Alignment.bottomCenter,
                      colors: [DZColors.hexStringColor("#F97FF8"), DZColors.hexStringColor("#FAB0CA")],
                    ),
                  ),
                  child: const Text(
                    "开通会员",
                    style: TextStyle(fontSize: 13, color: Colors.white, height: 1.2),
                  ),
                ),
              ),
              GestureDetector(
                onTap: onTapPay,
                behavior: HitTestBehavior.opaque,
                child: Container(
                  height: 40,
                  margin: const EdgeInsets.only(bottom: 10),
                  alignment: Alignment.center,
                  decoration: BoxDecoration(
                    borderRadius: BorderRadius.circular(30),
                    // 渐变色
                    gradient: LinearGradient(
                      begin: Alignment.topCenter,
                      end: Alignment.bottomCenter,
                      colors: [DZColors.hexStringColor("#FAAD75"), DZColors.hexStringColor("#FDD172")],
                    ),
                  ),
                  child: Text(
                    "支付$money金币",
                    style: const TextStyle(fontSize: 13, color: Colors.white, height: 1.2),
                  ),
                ),
              ),
              GestureDetector(
                onTap: () => Navigator.pop(context),
                child: Container(
                  height: 40,
                  width: 90,
                  margin: const EdgeInsets.only(bottom: 8),
                  alignment: Alignment.center,
                  decoration: BoxDecoration(
                    borderRadius: BorderRadius.circular(30),
                    border: Border.all(color: DZColors.contentColor, width: 1),
                  ),
                  child: const Text(
                    "放弃发布",
                    style: TextStyle(fontSize: 13, color: DZColors.contentColor, height: 1.2),
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
